import csv
import subprocess
import sys

user = sys.argv[1]
table = [line for line in csv.reader(open('table.csv'))]

for ip, latitude, longitude in table[1:]:
    print(ip, latitude, longitude)
    command = f'echo "Ip: {ip}; geo: {latitude},{longitude}" >> server_config'
    subprocess.call(f'ssh {user}@{ip} {command}'.split())

